%% Carbon Taxes Around the World: Cooperation, Strategic Interactions, and Spillovers
% IMF Economic Review
% Alessandro Moro and Valerio Nispi Landi
% Replication files
% This file plots Figure 4

clc; clear all; close all; 

SAVE=0;
SYM=0;
PAPER=1;
load irf_sp_psi0
load irf_ne_psi0
load irf_sp_psi05
load irf_ne_psi05
load irf_sp_psi1
load irf_ne_psi1

usedfont='Georgia';
FigW=17;
FigH=1.5*FigW;

if PAPER==1 
figure;
set(gcf,'color', 'white',...
        'PaperUnits','centimeters','PaperSize',[FigW FigH],...
        'PaperPosition',[0,0,FigW,FigH],'PaperPositionMode','manual',...
        'Units','centimeters',...
        'Position',[0,0,FigW,FigH]);
   
subplot(3,2,1)    
plot([2020:1:2421], xs_ne_psi0,'b','Linewidth',2)
hold on  
plot([2020:1:2421], xs_ne_psi05,'r:','Linewidth',2)
hold on
plot([2020:1:2421], xs_ne_psi1,'k--','Linewidth',2)
ax = gca;
ax.FontSize = 14; 
ax.YAxis.Exponent = 0;
ylim([800 max(xs_ne_psi0)])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])
title('Atm. carbon (GtC), NE','Fontsize',14,'fontweight','bold')

subplot(3,2,2)    
plot([2020:1:2421], xs_sp_psi0,'b','Linewidth',2)
hold on  
plot([2020:1:2421], xs_sp_psi05,'r:','Linewidth',2)
hold on
plot([2020:1:2421], xs_sp_psi1,'k--','Linewidth',2)
ax = gca;
ax.FontSize = 14; 
ax.YAxis.Exponent = 0;
ylim([800 max(xs_ne_psi0)])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])

title('Atm. carbon (GtC), SP','Fontsize',14,'fontweight','bold')
    
subplot(3,2,3)    
plot([2020:1:2421], muW_ne_psi0,'b','Linewidth',2)
hold on  
plot([2020:1:2421], muW_ne_psi05,'r:','Linewidth',2)
hold on
plot([2020:1:2421], muW_ne_psi1,'k--','Linewidth',2)
ax = gca;
ax.FontSize = 14; 
ax.YAxis.Exponent = 0;
ylim([0 1])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])

title('Abatement rate, NE','Fontsize',14,'fontweight','bold')

subplot(3,2,4)    
plot([2020:1:2421], muW_sp_psi0,'b','Linewidth',2)
hold on  
plot([2020:1:2421], muW_sp_psi05,'r:','Linewidth',2)
hold on
plot([2020:1:2421], muW_sp_psi1,'k--','Linewidth',2)
ax = gca;
ax.FontSize = 14; 
ax.YAxis.Exponent = 0;
ylim([0 1])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])

title(['Abatement rate, SP'],'Fontsize',14,'fontweight','bold')

% subplot(4,2,5)    
% plot([2020:1:2060], gdps_ne_psi0(1:41),'b','Linewidth',2)
% hold on  
% plot([2020:1:2060], gdps_ne_psi05(1:41),'r:','Linewidth',2)
% hold on
% plot([2020:1:2060], gdps_ne_psi1(1:41),'k--','Linewidth',2)
% ax = gca;
% ax.FontSize = 14; 
% ax.YAxis.Exponent = 0;
% ylim([1  max(gdps_ne_psi1(1:41))])
% xlim([2020 2060])
% xticks([2020 2030 2040 2050 2060])
% 
% title('GDP, NE','Fontsize',14,'fontweight','bold')
% 
% subplot(4,2,6)    
% plot([2020:1:2060], gdps_sp_psi0(1:41),'b','Linewidth',2)
% hold on  
% plot([2020:1:2060], gdps_sp_psi05(1:41),'r:','Linewidth',2)
% hold on
% plot([2020:1:2060], gdps_sp_psi1(1:41),'k--','Linewidth',2)
% ax = gca;
% ax.FontSize = 14; 
% ax.YAxis.Exponent = 0;
% ylim([1  max(gdps_sp_psi1(1:41))])
% xlim([2020 2060])
% xticks([2020 2030 2040 2050 2060])
% 
% title('GDP, SP','Fontsize',14,'fontweight','bold')


subplot(3,2,5)    
plot([2020:1:2421], priceW_ne_psi0,'b','Linewidth',2)
hold on  
plot([2020:1:2421], priceW_ne_psi05,'r:','Linewidth',2)
hold on
plot([2020:1:2421], priceW_ne_psi1,'k--','Linewidth',2)
ax = gca;
ax.FontSize = 14; 
ax.YAxis.Exponent = 0;
ylim([0  max(priceW_ne_psi1)])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])

title('Carbon price $/tCo2, NE','Fontsize',14,'fontweight','bold')

subplot(3,2,6)    
plot([2020:1:2421], priceW_sp_psi0,'b','Linewidth',2)
hold on  
plot([2020:1:2421], priceW_sp_psi05,'r:','Linewidth',2)
hold on
plot([2020:1:2421], priceW_sp_psi1,'k--','Linewidth',2)
ax = gca;
ax.FontSize = 14; 
ax.YAxis.Exponent = 0;
ylim([0  max(priceW_sp_psi1)])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])
title('Carbon price $/tCo2, SP','Fontsize',14,'fontweight','bold')
leg=legend('\psi_X=0','\psi_X=0.5','\psi_X=1','Location','southoutside','Orientation','horizontal','Box','off','Fontsize',16);   
leg.Position(1) = 0.25;
leg.Position(2) = 0.01;
if SAVE==1 && SYM==0
%print('-dpng','-r500',['./figures/ne_sp_irf_asym_lin.png'])
elseif SAVE==1 && SYM==1
print('-dpng','-r500',['./figures/ne_sp_irf.png'])
    
end

else
%% Presentation

FigW=34;
FigH=0.5*FigW;
figure;
set(gcf,'color', 'white',...
        'PaperUnits','centimeters','PaperSize',[FigW FigH],...
        'PaperPosition',[0,0,FigW,FigH],'PaperPositionMode','manual',...
        'Units','centimeters',...
        'Position',[0,0,FigW,FigH]);
    
subplot(1,3,1)    
plot([2020:1:2421], xs_ne_psi0,'b','Linewidth',2)
hold on
plot([2020:1:2421], xs_sp_psi0,'b:','Linewidth',2)
% hold on
% plot([2020:1:2421], xs_ne_psi1,'r','Linewidth',2)
% hold on
% plot([2020:1:2421], xs_sp_psi1,'r:','Linewidth',2)
ax = gca;
ax.FontSize = 18; 
ax.YAxis.Exponent = 0;
ylim([800 max(xs_ne_psi0)])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])
title('Atm. carbon (GtC)','Fontsize',18,'fontweight','bold')



subplot(1,3,2)    
plot([2020:1:2421], muW_ne_psi0,'b','Linewidth',2)
hold on
plot([2020:1:2421], muW_sp_psi0,'b:','Linewidth',2)
% hold on
% plot([2020:1:2421], muW_ne_psi1,'r','Linewidth',2)
% hold on
% plot([2020:1:2421], muW_sp_psi1,'r:','Linewidth',2)
ax = gca;
ax.FontSize = 18; 
ax.YAxis.Exponent = 0;
ylim([0 1])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])
title('Abatement rate','Fontsize',18,'fontweight','bold')
%legend('Linear NE','Linear SP','Quadratic NE','Quadratic SP','Location','Southeast','Fontsize',18)   
legend('Linear NE','Linear SP','Location','Southeast','Fontsize',18)   


    
subplot(1,3,3)    
plot([2020:1:2421], priceW_ne_psi0,'b','Linewidth',2)
hold on
plot([2020:1:2421], priceW_sp_psi0,'b:','Linewidth',2)
% hold on
% plot([2020:1:2421], priceW_ne_psi1,'r','Linewidth',2)
% hold on
% plot([2020:1:2421], priceW_sp_psi1,'r:','Linewidth',2)
ax = gca;
ax.FontSize = 18; 
ax.YAxis.Exponent = 0;
ylim([0  max(priceW_ne_psi1)])
xlim([2020 2421])
xticks([2020 2120 2220 2320 2420])
title('Carbon price $/tCo2','Fontsize',18,'fontweight','bold')


if SAVE==1    
print('-dpng','-r500',['./figures/ne_sp_irf_pres2.png'])
end
end